from Base.Base1 import Base1
from selenium.webdriver.common.by import By
import time

class Page1(Base1):
    login_loc = (By.XPATH,'//a[@href="/home/login.html"]')
    def login(self):
        self.click(self.login_loc)

    dy1_loc = (By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]')
    def dy1(self):
        self.text(self.dy1_loc)

    username_loc = (By.NAME,'username')
    def username(self,username):
        self.send_keys(self.username_loc,username)

    password_loc = (By.NAME,'password')
    def password(self,password):
        self.send_keys(self.password_loc,password)

    loginbtn_loc = (By.CLASS_NAME,'finish-btn')
    def loginbtn(self):
        self.click(self.loginbtn_loc)

    dy2_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dy2(self):
        self.text(self.dy2_loc)

    def luoji_A3mall_login(self,username,password):
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        self.dy1()
        self.username(username)
        self.password(password)
        self.sleep(10)
        self.loginbtn()
        self.sleep(5)
        self.dy2()